# 猜数游戏
# ! /usr/bin/python3
import random

print("请先输入猜数的范围!")
high = int(input())
low = 1
num = random.randint(1, high)

print("游戏开始，请输入你猜的数字！")

while True:
    guess = int(input())
    if guess == num:
        print("恭喜你，猜中了！这个数字就是%d!" % num)
        break
    elif guess > num:
        high = guess
        print("请重新猜数，猜数范围在%d和%d之间！" % (low, high))
    elif guess < num:
        low = guess
        print("请重新猜数，猜数范围在%d和%d之间！" % (low, high))
